import React from "react"


export default class Fromdemo extends React.Component {

    constructor(){
        super()
        this.state ={
            value:""
        }
    }
    handleSubmit = (e) =>{
        e.preventDefault();
        console.log(this.state.value);
    }
    onShangeHandler=(e)=>{
        this.setState({
            value:e.target.value
        })
    }
    render() {
        return (

            <div>
                <form onSubmit={this.handleSubmit}>
                    <input type="text" value={this.state.value } onChange={ this.onShangeHandler }/>
                    <input type="submit" value="提交"/>
                </form>
            </div>

        )
    }
}